import { useContext } from 'react';
import { NavBar, List } from 'antd-mobile';
import { useHistory } from 'react-router-dom';
import { CloudDownloadOutlined } from '@ant-design/icons';

import { MySdkStoreContext } from '../../../context';

export default function() {
  const history = useHistory();
  const mySdkStore = useContext(MySdkStoreContext);

  const downloadLog = async () => {
    await mySdkStore.sdk.downloadLog();
  }

  return (<div className="mySettingPage">
    <NavBar onBack={() => history.goBack()} style={{ background: '#fff', border: 'none' }}>通用设置</NavBar>
    <List style={{ '--border-top': 0, '--border-bottom': 0, '--border-inner': 0, marginTop: 12 }}>
      <List.Item arrow={<CloudDownloadOutlined style={{ color: '#1677ff', fontSize: 20 }} />} onClick={downloadLog}>
        下载日志数据
      </List.Item>
    </List>
  </div>)
}